﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LinQProject;
using LinQProject.Repository;


namespace ServiceProject.EntityService
{
    public class ProviderService:DataBaseProcessBase<Provider>
    {
        public ProviderService(FarmacieDataClassesDataContext database) : base(database)
        {}

        public Provider GetProviderById(int providerId)
        {
            IList<Provider> listProvider=base.GetAll(p => p.ProviderId == providerId);
            if (listProvider.Count == 0)
                return null;
            return listProvider[0];
        }

        public Provider GetActiveProvider()
        {
            IList<Provider> listaProvider = base.GetAll(p => p.IsActive);
            if (listaProvider.Count > 0)
                return listaProvider[0];
            return null;
        }
    }
}
